<?php 
require_once '../classes/database.php';
require_once '../classes/simple_html_dom.php';
require_once '../classes/images.class.php';
require_once '../functions/functions.php';
require_once '../functions/rewrite_functions.php';
require_once '../functions/resize_image.php';
require_once '../functions/functions_getlink.php';
require_once '../classes/generate_form.php';
require_once '../classes/curl.php';
require_once 'classgetNew.php';

//Post dữ liệu lên hot
function postDataToAPIByCURL($data, $url = '', $method = 'post', $return = true) {
        define('URL_NIFTY_API','http://vnupdate.net/getNews/data_api.php');
        $url = ($url == '') ? URL_NIFTY_API : $url;
        $ch = curl_init($url);
        if($method == 'post') {
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        }
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        if($return) {
             $data = curl_exec($ch);
             $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
             return array('status' => $status, 'respone_text' => $data);
        }
}
?>